define(['jquery'], () => {
  const basic_url = 'http://rap2api.taobao.org/app/mock/269560'
  const gitList_url = basic_url + '/shop/list'
  // 熊猫优选
  const xmBaseUrl = 'http://www.xiongmaoyouxuan.com/api'
  const tabs_url = xmBaseUrl + '/tabs'
  const list_base_url = xmBaseUrl + '/tab' 
  const detail_url = xmBaseUrl + '/detail'


  // 基于jquery的get请求封装了一个promise
  const get = (url, data) => {
    return new Promise((resolve, reject) => {
      $.get(url, data, resp => {
        resolve(resp)
      })
    })
  }

  return{
    getGiftList() {
      return get(gitList_url)
    },
    // 熊猫优选
    getTabs () {
      return get(tabs_url)
    },
    getList (id) {
      return get(`${list_base_url}/${id}`)
    },
    getDetail (id) {
      return get(detail_url, { id })
    }
  }
})